package cn.yx.common.jpa.pojo;

import cn.yx.common.core.pojo.base.BaseDo;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.util.Date;

/**
 * <p>DO基类，使用JPA相关注解，如@MappedSupperclass, @Id, @Column等</p>
 *
 * @author Wgssmart
 */
@Data
@MappedSuperclass
public class SingleDo extends BaseDo {

    /**
     * 主键ID，编号
     */
    @Id
    @GenericGenerator(name = "snowflakeIdGenerator", strategy = "cn.yx.common.jpa.repository.SnowflakeIdGenerator")
    @GeneratedValue(generator = "snowflakeIdGenerator")
    @Column(name = "id")
    private Long id;

    /**
     * 版本号
     */
    @Column(name = "version")
    private Integer version;

    /**
     * 是否激活，0否1是
     */
    @Column(name = "is_active")
    private Byte isActive;

    /**
     * 创建人ID
     */
    @Column(name = "create_by")
    private Long createBy;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 更新人ID
     */
    @Column(name = "update_by")
    private Long updateBy;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private Date updateTime;

}